﻿using System.Data.Entity.ModelConfiguration;
using ZSoftInstagram.Domain.User;

namespace ZSoftInstagram.DataAccess.Config
{
    public class ApplicationUserConfig: EntityTypeConfiguration<ApplicationUser>
    {
        public ApplicationUserConfig()
        {
            this.HasKey(u => u.Id);

            this.HasMany(u => u.PinBoards)
                    .WithOptional(p => p.User)
                        .HasForeignKey(p => p.UserId);

            this.HasMany(u => u.Likes)
                .WithOptional(l => l.User)
                .HasForeignKey(l => l.UserId);
        }
    }
}
